#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable:6031)

/* malloc example: random string generator*/
#include <stdio.h>      /* printf, scanf, NULL */
#include <stdlib.h>     /* malloc, free, rand */

/*
int main()
{
    int i = 0;
    int n = 0;
    char* buffer = NULL;

    printf("How long do you want the string?\n");
    scanf("%d", &i);

    buffer = (char*)malloc(i + 1);

    if (buffer == NULL)
    {
        exit(EXIT_FAILURE);
        printf("victory");
    }

    for (n = 0; n < i; n++)
    {
        buffer[n] = rand() % 26 + 'a';
    }
    buffer[i] = '\0';

    printf("Random string: %s\n", buffer);

    free(buffer);

    return 0;
}
*/

int main()
{
    int n = 5;
    int* p = NULL;
    p = (int*)malloc(n * sizeof(int));

    int i = 0;
   
    if (p == NULL)
    {
        exit(EXIT_SUCCESS);
    }

    for (i = 0; i < 5; i++)
    {
        scanf("%d", p + i);
    }

    for (i = 0; i < 5; i++)
    {
        printf("%d ", *(p + i));
    }
    ;
    free(p);

    return 0;
}

//test cases
// 
//1.
/*
1 2 3 4 5
*/
//expected result
/*
1 2 3 4 5
*/